package art_of_java_concurrent_programming.lock.exclusive;

/**
 * @author lixiangke
 * @date 2018/1/26
 */
public class MutexTest {
    public static void main(String[] args) throws InterruptedException {
        Counter counter = new Counter();

        Thread t1 = new Thread() {
            @Override
            public void run() {
                counter.increment();
            }
        };
        Thread t2 = new Thread() {
            @Override
            public void run() {
                counter.increment();
            }
        };
        Thread t3 = new Thread() {
            @Override
            public void run() {
                counter.increment();
            }
        };
        Thread t4 = new Thread() {
            @Override
            public void run() {
                counter.increment();
            }
        };

        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}
